package ar.edu.utn.frgp.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ar.edu.utn.frgp.model.Cliente;
import ar.edu.utn.frgp.servicio.ClienteService;




public class ClientesServlet extends GenericServlet  {

	private static final long serialVersionUID = 1L;
	private ClienteService clientetService;
	
	public ClientesServlet(){
		super();
		clientetService = new ClienteService();
	}

	@Override
	public void doAction(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		try {
			List<Cliente> client = clientetService.getClientes();
			request.setAttribute("clientes", client);
			request.getSession().setAttribute("clientesNombres", client);
			request.getRequestDispatcher("/clientes.jsp").forward(request, response);
			       
			
		} catch (Exception e) {
			e.printStackTrace();
		}		
	}
}
